/* AUTHOR -> ANATOLIJS BOGDANOVS */

#ifndef WALL_FOLLOW_H
#define WALL_FOLLOW_H_

#include "lpc_types.h"
/* ------------------------------------------------------------------------ */
// t_distance is the distance at which the robot should follow the wall
// at initialisation distance will be set to a predefined value of 23cm*
// if t_distance is passed < 10 || > 50, t_distance value will not change
// *23 is 30 - 7, where 7 is the distance from sensors to the mid of the robot
//
// side prefference should be given to say which wall to follow
// right = 1; left = -1; dont care = 0
// dont care will evaluate the closest/more desirable wall to follow
//
// every time the robot is needed to follow the wall
// evaluate_step should be called wich evaluates motor speeds needed to go
// to retrieve the motor speeds
// get_m1()[LEFT] and get_m2()[RIGHT] routines are provided
//
// reset_wall_follow will clear the last state of the robot it was at
// will trigger to reset wall prefference and reinitialise all values/flags
//
// motor speeds are limited to 0x2C
// please, do not alter this constraint
// unless you want to make a whirlwind during the demonstration
//
/* ------------------------------------------------------------------------ */
void init_wall_follow(uint8_t t_distance);
void evaluate_step(int8_t side_prefference, uint8_t t_distance);
void reset_wall_follow(uint8_t t_distance);
void set_distance(uint8_t t_distance);
uint8_t get_m1(void);
uint8_t get_m2(void);
uint8_t get_front_reading(void);
uint8_t get_rear_reading(void);

#endif
